﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;

/// <summary>
///Query 的摘要说明
/// </summary>
public class Query
{
    private string m_cmdstring;
    private SqlConnection m_cnn;

	public Query(string s)
	{
            m_cmdstring =s;
	}
    ~Query()
    {
        if (m_cnn!=null)
        {
            m_cnn.Close();
        }
    }
    public string doQuery(DataSet R)
    {
        try
        {
            m_cnn = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["connectString"]);
            m_cnn.Open();
            SqlDataAdapter myAdpter = new SqlDataAdapter(m_cmdstring, m_cnn);
            
            myAdpter.Fill(R, "DATA");

        }catch(Exception e)
        {
            return e.Message;
        }
        return "ok";
    }
}